package com.colin.project.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

@Configuration
public class JedisConfig {

    /**
     * Jedis配置类
     * maxTotal: 最大连接数
     * maxWaitMillis 获取不到连接时 最大等待时间
     * 其他均采用默认配置
     * @return jedisPool
     *
     */
    @Bean
    public JedisPool jedisPool() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(200);
        jedisPoolConfig.setMaxWaitMillis(60000);
        return new JedisPool(jedisPoolConfig, "127.0.0.1", 6379);
    }

}
